import requests

# 获取用户输入的问题
user_input = input("请输入问题：")

url = "https://api.ap.siliconflow.com/v1/chat/completions"

payload = {
    "model": "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
    "stream": False,
    "max_tokens": 512,
    "temperature": 0.7,
    "top_p": 0.7,
    "top_k": 50,
    "frequency_penalty": 0.5,
    "n": 1,
    "stop": [],
    "messages": [
        {
            "role": "system",
            "content": "请严格按以下规则判断：若用户希望房间更亮，回复1；否则回复0。只需输出数字。"
        },
        {
            "role": "user",
            "content": user_input
        }
    ]
}

headers = {
    "Authorization": "Bearer sk-hqzicwylthrvcltzzbwtsvgcjedbimykpiekkmolnyhibhyj",
    "Content-Type": "application/json"
}

try:
    response = requests.post(url, json=payload, headers=headers)
    response_data = response.json()
    answer = response_data['choices'][0]['message']['content'].strip()
    
    if answer == '1':
        print(1)
except Exception as e:
    print("处理请求时发生错误:", e)